/******************************************************************************
 * * setting_tone.c - implementation of tone setting functions
 *
 * *(C) Copyright 2019 Asr International Ltd.
 * * All Rights Reserved
 * ******************************************************************************/
#include "setting_global.h"

// level to speaker volume
const UINT8 g_VolumeLevel[11] =
{
    HAL_AUDIO_SPK_LEVEL_0,
    HAL_AUDIO_SPK_LEVEL_1,
    HAL_AUDIO_SPK_LEVEL_2,
    HAL_AUDIO_SPK_LEVEL_3,
    HAL_AUDIO_SPK_LEVEL_4,
    HAL_AUDIO_SPK_LEVEL_5,
    HAL_AUDIO_SPK_LEVEL_6,
    HAL_AUDIO_SPK_LEVEL_7,
    HAL_AUDIO_SPK_LEVEL_8,
    HAL_AUDIO_SPK_LEVEL_9,
    HAL_AUDIO_SPK_LEVEL_10
};

Setting_Tone_Setting_Mng_t  g_SettingToneSettingMng;
Setting_Tone_Function_Mng_t g_SettingToneFunctionMng;
Setting_Tone_Setting_Mng_t  *g_OperatingTone                      = NULL; // pointer of operating tone strcture for tone of profile
VOID                        *gp_SettingToneCurContainerListUIDesc = NULL; // Current Normal_Container_List UI description
VOID                        *gp_SettingToneCurListOnlyUIDesc      = NULL; // Current Normal_List_Only UI description

/**
 * sub-module entry
 * param (in) void
 * return  void
 */
VOID Setting_Tone_Main(VOID)
{
    // init manage variable
}

/**
 * sub-module event handler
 * param (in) void
 * return  void
 */
VOID Setting_Tone_Event_handle(VOID)
{
    // event and message dispatch
}

/**
 * initiate tone sub-module
 * param (in) NvPara: Setting_NVM_Para_t
 * return  void
 */
VOID Setting_Tone_Init_Req(NV_UI_Settings_t *pNvPara)
{
    // init manage variable
    Hal_Mem_Set(&g_SettingToneSettingMng, 0, sizeof(Setting_Tone_Setting_Mng_t));

    g_SettingToneSettingMng.CurrentRingToneIndex[0] = pNvPara->ToneSetting.CurrentRingToneIndex[0];
    g_SettingToneSettingMng.CurrentRingToneIndex[1] = pNvPara->ToneSetting.CurrentRingToneIndex[1];
    g_SettingToneSettingMng.RingVolume              = pNvPara->ToneSetting.RingVolume;
    g_SettingToneSettingMng.KeypadToneVolume        = pNvPara->ToneSetting.KeypadToneVolume;
    g_SettingToneSettingMng.VibratingStat           = (SETTING_VIBRATING_STAT)pNvPara->ToneSetting.VibratingStat;
    g_SettingToneSettingMng.MsgAlertStat[0]         = (SETTING_MSG_ALERT_STAT)pNvPara->ToneSetting.MsgAlertStat[0];
    g_SettingToneSettingMng.MsgAlertStat[1]         = (SETTING_MSG_ALERT_STAT)pNvPara->ToneSetting.MsgAlertStat[1];
    g_SettingToneSettingMng.CurrentMsgToneIndex[0]  = pNvPara->ToneSetting.CurrentMsgToneIndex[0];
    g_SettingToneSettingMng.CurrentMsgToneIndex[1]  = pNvPara->ToneSetting.CurrentMsgToneIndex[1];
    g_SettingToneSettingMng.WarningToneStat         = (SETTING_WARNING_TONE_STAT)pNvPara->ToneSetting.WarningToneStat;

    // init other manage variable
    Hal_Mem_Set(&g_SettingToneFunctionMng, 0, sizeof(Setting_Tone_Function_Mng_t));

    g_SettingToneFunctionMng.RingPlaying         = FALSE;
    g_SettingToneFunctionMng.TonePrio            = SETTING_TONE_PRIO_NULL;
    g_SettingToneFunctionMng.ProfileActivateIdx  = g_SettingProfileActivateIdx;
    g_SettingToneFunctionMng.ProfileEditingIdx   = 0xFF;
    g_SettingToneFunctionMng.ProfileTimingSta    = FALSE;
    g_SettingToneFunctionMng.ProfileOperatingIdx = g_SettingProfileActivateIdx;
    
    // init ring list for temp, begin
    UINT8 i = 0;
    Hal_Mem_Set(g_RingToneList, 0, sizeof(Setting_Ring_Tone_t) * UI_RING_TONE_MAX);
    strcpy(g_RingToneList[0].RingName, "ring_01");
    strcpy(g_RingToneList[1].RingName, "ring_02");
    strcpy(g_RingToneList[2].RingName, "ring_03");
    strcpy(g_RingToneList[3].RingName, "ring_04");
    strcpy(g_RingToneList[4].RingName, "ring_05");
    strcpy(g_RingToneList[5].RingName, "ring_06");
    strcpy(g_RingToneList[6].RingName, "ring_07");
    strcpy(g_RingToneList[7].RingName, "ring_08");
    strcpy(g_RingToneList[8].RingName, "ring_09");
    strcpy(g_RingToneList[9].RingName, "ring_10");

    for (i = 0; i < UI_RING_TONE_MAX; i++)
    {
        g_RingToneList[i].RingPath = SETTING_AUDIO_MSG;
    }
    // end
}

/**
 * to get tone list for contact spec tone
 * param (in) void
 * return  If_Setting_Tone_List_t*: list of ring name
 */
If_Setting_Tone_List_t *Setting_Get_Tone_List_Req(VOID)
{
    If_Setting_Tone_List_t *ToneList = NULL;
    UINT8                  i         = 0;
    UINT8                  Cnt       = 0;

    Cnt      = UI_RING_TONE_MAX;
    ToneList = (If_Setting_Tone_List_t *)Hal_Mem_Alloc(Cnt * sizeof(If_Setting_Tone_List_t));
    Hal_Mem_Set(ToneList, 0, Cnt * sizeof(If_Setting_Tone_List_t));

    ToneList->RingNameCnt = Cnt;
    for (i = 0; i < Cnt; i++)
    {
        Hal_Mem_Copy(ToneList[i].RingName, g_RingToneList[i].RingName, IF_SETTING_MAX_NAME_LEN);
    }

    return(ToneList);
}

/**
 * to set ring volume
 * param (in) RingVolume: HAL_SPEAKER_GAIN
 * return  void
 */
VOID Setting_Set_Ring_Volume_Req(HAL_SPEAKER_GAIN RingVolume)
{
    UINT8 nvData = 0;

    // update global variables
    g_SettingToneSettingMng.RingVolume = RingVolume;
    printf("RingVolume is %d in Setting_Set_Ring_Volume_Req\n", RingVolume);
    // nv write
    nvData = (UINT8)RingVolume;
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 2), 1, &nvData);
}

/**
 * to get ring volume
 * param (in) void
 * return  UINT8: HAL_SPEAKER_GAIN
 */
UINT8 Setting_Get_Ring_Volume_Req(VOID)
{
    return(g_SettingToneSettingMng.RingVolume);
}

VOID Setting_Write_Ring_Tone_To_Nv(MMI_MODEM_SIM_ID SimId, UINT8 nvData)
{
    if(MMI_MODEM_SIM_1 == SimId) {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, NV_SETTING_TONE_SETTING_OFFSET, 1, &nvData);
    } else {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 1), 1, &nvData);
    }
}

/**
 * Set ring tone
 * param (in) SimId: MMI_MODEM_SIM_ID
 * param (in) ToneIndex: UINT8
 * return void:
 */
VOID Setting_Set_Ring_Tone(MMI_MODEM_SIM_ID SimId, UINT8 ToneIndex)
{
    UINT8 nvData = 0;

    printf("%s: CurrentRingToneIndex[%d] = %d\n", __FUNCTION__, SimId, ToneIndex);

    nvData = ToneIndex;
    // update global variables
    g_OperatingTone->CurrentRingToneIndex[SimId] = ToneIndex;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
            // write setting tone nv
            Setting_Write_Ring_Tone_To_Nv(SimId, nvData);
            // write setting profile nv
            Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, SimId, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
                // write setting tone nv
                Setting_Write_Ring_Tone_To_Nv(SimId, nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
                // write setting tone nv
                Setting_Write_Ring_Tone_To_Nv(SimId, nvData);
                // write setting profile nv
                Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
                    // write setting tone nv
                    Setting_Write_Ring_Tone_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
                // write setting profile nv
                Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.CurrentRingToneIndex[SimId] = ToneIndex;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Ring_Tone_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Ring_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        }
    }
}

/**
 * Set pointer of g_OperatingTone to tone or profile
 * param (in) VolumeBar: lv_obj_t*
 * param (in) VolumeUp: BOOL (true for volume up, false for volume down)
 * return void:
 */
VOID Setting_Set_Operating_Tone(Setting_Tone_Setting_Mng_t *OperatingTone)
{
    if(NULL == OperatingTone) {
        printf("%s: input parameter (OperatingTone) is NULL!\n", __FUNCTION__);
    } else {
        if(NULL == g_OperatingTone) {
            g_OperatingTone = (Setting_Tone_Setting_Mng_t *)Hal_Mem_Alloc(sizeof(Setting_Tone_Setting_Mng_t));
            printf("%s: g_OperatingTone malloc proc, address = %p\n", __FUNCTION__, g_OperatingTone);
        }
        printf("%s: set g_OperatingTone proc, address = %p\n", __FUNCTION__, g_OperatingTone);
        Hal_Mem_Set(g_OperatingTone, 0, sizeof(Setting_Tone_Setting_Mng_t));
        Hal_Mem_Copy(g_OperatingTone, OperatingTone, sizeof(Setting_Tone_Setting_Mng_t));
    }
}

VOID Setting_Write_Ring_Volume_To_Nv(UINT8 nvData)
{
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 2), 1, &nvData);
}

/**
 * Set ring Volume
 * param (in) Level: UINT8, refer to g_VolumeLevel[8]
 * return void:
 */
VOID Setting_Set_Ring_Volume(UINT8 Level)
{
    UINT8 nvData = 0;

    printf("%s: RingVolume = %d\n", __FUNCTION__, Level);

    if(TRUE == Audio_Player_Is_Running())
    {
        Hal_Audio_SetVolume((UINT16)Level);
    }

    nvData = Level;
    // update global variables
    g_OperatingTone->RingVolume = Level;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.RingVolume = Level;
            // write setting tone nv
            Setting_Write_Ring_Volume_To_Nv(nvData);
            // write setting profile nv
            Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.RingVolume = Level;
                // write setting tone nv
                Setting_Write_Ring_Volume_To_Nv(nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.RingVolume = Level;
                // write setting tone nv
                Setting_Write_Ring_Volume_To_Nv(nvData);
                // write setting profile nv
                Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.RingVolume = Level;
                    // write setting tone nv
                    Setting_Write_Ring_Volume_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.RingVolume = Level;
                // write setting profile nv
                Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.RingVolume = Level;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Ring_Volume_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Ring_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        }
    }
}

/**
 * Callback of Hal_Tone_Play_Onetime, Stop playing vibrating if setting
 * param (in) Para: UINT32
 * return void:
 */
VOID Setting_Stop_Play_Vibrating_Cb(VOID* Para)
{
    UINT32 pPara = *(UINT32 *)Para;
    printf("%s: VibSuppFlg = %d\n", __FUNCTION__, pPara);
    if (1 == pPara)
    {   // vibrate setting, stop playing Vib
        printf("%s: stop vib\n", __FUNCTION__);
        Hal_Vibrator_Play_End();
    }
    g_SettingToneFunctionMng.RingPlaying = FALSE;
    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_NULL;
    Audio_Player_Audio_Contine();
}

/**
 * Callback of Hal_Vibrator_Play_Onetime, Start playing tone and vibrating if setting
 * param (in) Para: UINT32
 * return void:
 */
VOID Setting_Start_Play_Tone_Vibrating_Cb(VOID* Para)
{
    // call hal interface
    UINT32* pPara = (UINT32*)Para;
    printf("%s: *pPara=%d\n", __FUNCTION__, *pPara);
    Hal_NFFS_File_Play_Repeat(g_RingToneList[*pPara].RingPath, (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume);

#if 0
    if (SETTING_VIBRATING_RING_THEN == g_SettingToneSettingMng.VibratingStat)
    {   // vibrate setting
        Hal_Vibrator_Play_Repeat();
    }
#endif

    Hal_Mem_Free(Para);
}

/**
 * Common function for stopping tone and vibrating
 * param (in) void
 * return void:
 */
VOID Setting_Stop_Tone_Vibrating(VOID)
{
    printf("%s\n", __FUNCTION__);

    if(TRUE != Audio_Player_Is_Running())
    {
        Hal_Tone_Play_End();
        if (SETTING_VIBRATING_OFF != g_SettingToneSettingMng.VibratingStat) {
            // vibrate setting
            Hal_Vibrator_Play_End();
        }
        g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_NULL;
    }
}

VOID Setting_Stop_Tone_Vibrating_Ui(VOID)
{
    printf("%s\n", __FUNCTION__);

    if(TRUE != Audio_Player_Is_Running())
    {
        Hal_Tone_Play_End();
        if (SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat) {
            // vibrate setting
            Hal_Vibrator_Play_End();
        }
        g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_NULL;
    }
}

/**
 * Play ring tone for one time when tone was selected
 * param (in) ToneIndex: UINT8
 * param (in) Level: UINT8
 * param (in) VibSupp: BOOL
 * return void:
 */
VOID Setting_Play_Tone(UINT8 ToneIndex, UINT8 Level, BOOL VibSupp)
{
    static UINT32  VibSuppFlg = 0;
    VibSuppFlg = (FALSE == VibSupp ? 0 : 1);

    printf("%s: VibSupp = %d, VibSuppFlg = %d\n", __FUNCTION__, VibSupp, VibSuppFlg);
    // call hal interface
    Hal_NFFS_File_Play_Onetime(g_RingToneList[ToneIndex].RingPath,(HAL_SPEAKER_GAIN)Level,Setting_Stop_Play_Vibrating_Cb,(VOID *)&VibSuppFlg);

    if (TRUE == VibSupp)
    {   // vibrate setting
        printf("%s: Vib start\n", __FUNCTION__);
        Hal_Vibrator_Play_Repeat();
    }
}

/**
 * Play ring tone for incoming call
 * param (in) ToneIndex: UINT8
 * return void:
 */
VOID Setting_Play_Call_Tone(UINT8 ToneIndex)
{
    UINT32 *pToneIndex = NULL;

    // call hal interface
    switch (g_SettingToneSettingMng.VibratingStat)
    {
    case SETTING_VIBRATING_OFF:
        // vibrating do not set
        Hal_NFFS_File_Play_Repeat(g_RingToneList[ToneIndex].RingPath, (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume);
        break;

    case SETTING_VIBRATING_ON:
        // vibrating set
        Hal_NFFS_File_Play_Repeat(g_RingToneList[ToneIndex].RingPath, (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume);
        Hal_Vibrator_Play_Repeat();
        break;

    case SETTING_VIBRATING_RING_THEN:
        // vibrate first, then play tone with vibrating
        pToneIndex = (UINT32 *)Hal_Mem_Alloc(sizeof(UINT32));
        *pToneIndex = ToneIndex;
        Hal_Vibrator_Play_Onetime_With_Para(Setting_Start_Play_Tone_Vibrating_Cb, (void *)pToneIndex, 1000);
        break;

    default:
        break;
    }
}

/**
 * Play tone for power on/off
 * param (in) PowerOnOff: BOOL
 * param (in) Cb: CB_FUNC
 * return  void
 */
VOID Setting_Play_System_Tone_Req(CB_FUNC Cb)
{
    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SYSTEM;
    Hal_NFFS_File_Play_Onetime(SETTING_AUDIO_POWER_ON,
                               (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume,
                               Cb,
                               NULL);
}

/**
 * Ask tone setting module to play tone/vibrating
 * param (in) simId: MMI_MODEM_SIM_ID
 * return  void
 */
VOID Setting_Play_Tone_Req(If_Setting_Play_Tone_t *SettingPlayTone)
{
    BOOL VibSupp = FALSE;
    UINT8 Volume;

    if (IF_SETTING_PLAY_TONS_STOP == SettingPlayTone->PlayCtrl)
    {
        if (TRUE == g_SettingToneFunctionMng.RingPlaying)
        {
            printf("Stop occation: stopping all tone\n");
            g_SettingToneFunctionMng.RingPlaying = FALSE;
            Setting_Stop_Tone_Vibrating();
            if (IF_SETTING_TONS_TYPE_AUDIO_PLAYER != SettingPlayTone->ToneType)
            {
                Audio_Player_Audio_Contine();
            }
            else
            {
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_NULL;
            }
        }
    }
    else
    {
        if (SETTING_VIBRATING_OFF != g_SettingToneSettingMng.VibratingStat)
        {
            VibSupp = TRUE;
        }

        switch (SettingPlayTone->ToneType)
        {
        case IF_SETTING_TONS_TYPE_CALL:
            if(TRUE == Audio_Player_Is_Running())
            {
                Audio_Player_Audio_Stop();
            }
            g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_CALL;
            if (IF_SETTING_INVALID_TONE != SettingPlayTone->SpecToneIndex)
            {
                Setting_Play_Call_Tone(SettingPlayTone->SpecToneIndex);
            }
            else
            {
                Setting_Play_Call_Tone(g_SettingToneSettingMng.CurrentRingToneIndex[SettingPlayTone->SimId]);
            }
            break;

        case IF_SETTING_TONS_TYPE_SMS:
            if(SETTING_TONE_PRIO_SMS >= g_SettingToneFunctionMng.TonePrio) {
                printf("Stop occation: play SMS tone\n");
                if(TRUE == Audio_Player_Is_Running())
                {
                    Audio_Player_Audio_Stop();
                }
                Setting_Stop_Tone_Vibrating();
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SMS;
                Setting_Play_Tone(g_SettingToneSettingMng.CurrentMsgToneIndex[SettingPlayTone->SimId],
                                  g_SettingToneSettingMng.RingVolume,
                                  VibSupp);
            }
            break;

        case IF_SETTING_TONS_TYPE_KEYPAD:
            if (0 != g_SettingToneSettingMng.KeypadToneVolume) {
                if(SETTING_TONE_PRIO_KEYPAD >= g_SettingToneFunctionMng.TonePrio) {
                    printf("Stop occation: play Keypad tone\n");
                    Setting_Stop_Tone_Vibrating();
                    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_KEYPAD;

                    if(TRUE == Call_Setting_Is_Call_Present()) {
                        Volume = Call_Setting_Get_Speaker_Volume();
                    } else {
                        Volume = g_SettingToneSettingMng.KeypadToneVolume;
                    }

                    Setting_Play_Tone(0, Volume, FALSE); /*tone to be determined*/
                }
            }
            break;

        case IF_SETTING_TONS_TYPE_WARNING:
            if (SETTING_WARNING_TONE_ON == g_SettingToneSettingMng.WarningToneStat) {
                if(SETTING_TONE_PRIO_WARNING >= g_SettingToneFunctionMng.TonePrio) {
                    printf("Stop occation: play waring tone\n");
                    if(TRUE == Audio_Player_Is_Running())
                    {
                        Audio_Player_Audio_Stop();
                    }
                    Setting_Stop_Tone_Vibrating();
                    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_WARNING;
                    Setting_Play_Tone(0, g_SettingToneSettingMng.RingVolume, FALSE); /*tone to be determined*/
                }
            }
            break;

        case IF_SETTING_TONS_TYPE_CONTACTS:
            if (IF_SETTING_INVALID_TONE != SettingPlayTone->SpecToneIndex) {
                if(SETTING_TONE_PRIO_CONTACTS >= g_SettingToneFunctionMng.TonePrio) {
                    printf("Stop occation: play contacts tone\n");
                    Setting_Stop_Tone_Vibrating();
                    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_CONTACTS;
                    Setting_Play_Tone(SettingPlayTone->SpecToneIndex,
                                      g_SettingToneSettingMng.RingVolume,
                                      VibSupp);
                }
            }
            break;

        case IF_SETTING_TONS_TYPE_ALARM:
            if (IF_SETTING_INVALID_TONE != SettingPlayTone->SpecToneIndex) {
                if(SETTING_TONE_PRIO_ALARM >= g_SettingToneFunctionMng.TonePrio) {
                    printf("Stop occation: play alarm tone\n");
                    if(TRUE == Audio_Player_Is_Running())
                    {
                        Audio_Player_Audio_Stop();
                    }
                    Setting_Stop_Tone_Vibrating();
                    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_ALARM;
                    Hal_NFFS_File_Play_Repeat(g_RingToneList[SettingPlayTone->SpecToneIndex].RingPath,
                                              (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume);
                }
            }
            break;

        case IF_SETTING_TONS_TYPE_CALENDAR:
            if(SETTING_TONE_PRIO_CALENDAR >= g_SettingToneFunctionMng.TonePrio) {
                printf("Stop occation: play calendar tone\n");
                if(TRUE == Audio_Player_Is_Running())
                {
                    Audio_Player_Audio_Stop();
                }
                Setting_Stop_Tone_Vibrating();
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_CALENDAR;
                Hal_NFFS_File_Play_Repeat(g_RingToneList[0].RingPath,
                                          (HAL_SPEAKER_GAIN)g_SettingToneSettingMng.RingVolume);
            }
            break;

        case IF_SETTING_TONE_TYPE_SYSTEM:
            /*not handle*/
            break;

        case IF_SETTING_TONS_TYPE_AUDIO_PLAYER:
            if(SETTING_TONE_PRIO_AUDIO_PLAYER > g_SettingToneFunctionMng.TonePrio) {
                printf("Stop occation: play music \n");
                Setting_Stop_Tone_Vibrating();
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_AUDIO_PLAYER;
            }
            break;

        default:
            break;
        }
        g_SettingToneFunctionMng.RingPlaying = TRUE;
        printf("g_SettingToneFunctionMng.RingPlaying is TRUE in %s\n",__FUNCTION__);
    }
    Hal_Mem_Free(SettingPlayTone);
} /* Setting_Play_Tone_Req */

/**
 * Inform setting that power on tone play end
 * param (in) VOID
 * return VOID
 */
extern VOID Setting_Power_On_Tone_End_Ind(VOID)
{
    g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_NULL;
}

VOID Setting_Write_Vibrating_To_Nv(UINT8 nvData)
{
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 4), 1, &nvData);
}

/**
 * Set vibrating state
 * param (in) VibratingStat: SETTING_VIBRATING_STAT
 * return void:
 */
VOID Setting_Set_Vibrating(SETTING_VIBRATING_STAT VibratingStat)
{
    UINT8 nvData = 0;

    printf("%s: VibratingStat = %d\n", __FUNCTION__, VibratingStat);

    nvData = (UINT8)VibratingStat;
    // update global variables
    g_OperatingTone->VibratingStat = VibratingStat;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.VibratingStat = VibratingStat;
            //  write setting tone nv
            Setting_Write_Vibrating_To_Nv(nvData);
            //  write setting profile nv
            Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.VibratingStat = VibratingStat;
                //  write setting tone nv
                Setting_Write_Vibrating_To_Nv(nvData);
            } else {
            }
            //  write setting profile nv
            Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.VibratingStat = VibratingStat;
                // write setting tone nv
                Setting_Write_Vibrating_To_Nv(nvData);
                // write setting profile nv
                Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.VibratingStat = VibratingStat;
                    //  write setting tone nv
                    Setting_Write_Vibrating_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.VibratingStat = VibratingStat;
                // write setting profile nv
                Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.VibratingStat = VibratingStat;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    //  write setting tone nv
                    Setting_Write_Vibrating_To_Nv(nvData);
                } else {
                }
                //  write setting profile nv
                Setting_Profile_Write_Vibrating_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        }
    }
}

VOID Setting_Write_Alert_Stat_To_Nv(MMI_MODEM_SIM_ID SimId, UINT8 nvData)
{
    if(MMI_MODEM_SIM_1 == SimId) {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 5), 1, &nvData);
    } else {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 6), 1, &nvData);
    }
}

/**
 * Set message alert state
 * param (in) SimId: MMI_MODEM_SIM_ID
 * param (in) ToneIndex: SETTING_MSG_ALERT_STAT
 * return void:
 */
VOID Setting_Set_Alert_Stat(MMI_MODEM_SIM_ID SimId, SETTING_MSG_ALERT_STAT MsgAlertStat)
{
    UINT8 nvData = 0;

    printf("%s: MsgAlertStat[%d] = %d\n", __FUNCTION__, SimId, MsgAlertStat);

    nvData = (UINT8)MsgAlertStat;
    // update global variables
    g_OperatingTone->MsgAlertStat[SimId] = MsgAlertStat;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
            // write setting tone nv
            Setting_Write_Alert_Stat_To_Nv(SimId, nvData);
            // write setting profile nv
            Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, SimId, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
                // write setting tone nv
                Setting_Write_Alert_Stat_To_Nv(SimId, nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
                // write setting tone nv
                Setting_Write_Alert_Stat_To_Nv(SimId, nvData);
                // write setting profile nv
                Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
                    // write setting tone nv
                    Setting_Write_Alert_Stat_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
                // write setting profile nv
                Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.MsgAlertStat[SimId] = MsgAlertStat;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Alert_Stat_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Alert_Stat_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        }
    }
}

VOID Setting_Write_Message_Tone_To_Nv(MMI_MODEM_SIM_ID SimId, UINT8 nvData)
{
    if(MMI_MODEM_SIM_1 == SimId) {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 7), 1, &nvData);
    } else {
        UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 8), 1, &nvData);
    }
}

/**
 * Set message tone
 * param (in) SimId: MMI_MODEM_SIM_ID
 * param (in) ToneIndex: UINT8
 * return void:
 */
VOID Setting_Set_Message_Tone(MMI_MODEM_SIM_ID SimId, UINT8 ToneIndex)
{
    UINT8 nvData = 0;

    printf("%s: CurrentMsgToneIndex[%d] = %d\n", __FUNCTION__, SimId, ToneIndex);

    nvData = ToneIndex;
    // update global variables
    g_OperatingTone->CurrentMsgToneIndex[SimId] = ToneIndex;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
            // write setting tone nv
            Setting_Write_Message_Tone_To_Nv(SimId, nvData);
            // write setting profile nv
            Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, SimId, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
                // write setting tone nv
                Setting_Write_Message_Tone_To_Nv(SimId, nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
                // write setting tone nv
                Setting_Write_Message_Tone_To_Nv(SimId, nvData);
                // write setting profile nv
                Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
                    // write setting tone nv
                    Setting_Write_Message_Tone_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
                // write setting profile nv
                Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, SimId, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.CurrentMsgToneIndex[SimId] = ToneIndex;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Message_Tone_To_Nv(SimId, nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Message_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, SimId, nvData);
            }
        }
    }
}

VOID Setting_Write_Keypad_Tone_Volume_To_Nv(UINT8 nvData)
{
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 3), 1, &nvData);
}

/**
 * Set keypad tone volume
 * param (in) Level: UINT8
 * return void:
 */
VOID Setting_Set_Keypad_Tone_Volume(UINT8 Level)
{
    UINT8 nvData = 0;

    printf("%s: KeypadToneVolume = %d\n", __FUNCTION__, Level);

    nvData = Level;
    // update global variables
    g_OperatingTone->KeypadToneVolume = Level;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.KeypadToneVolume = Level;
            // write setting tone nv
            Setting_Write_Keypad_Tone_Volume_To_Nv(nvData);
            // write setting profile nv
            Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.KeypadToneVolume = Level;
                // write setting tone nv
                Setting_Write_Keypad_Tone_Volume_To_Nv(nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.KeypadToneVolume = Level;
                // write setting tone nv
                Setting_Write_Keypad_Tone_Volume_To_Nv(nvData);
                // write setting profile nv
                Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.KeypadToneVolume = Level;
                    // write setting tone nv
                    Setting_Write_Keypad_Tone_Volume_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.KeypadToneVolume = Level;
                // write setting profile nv
                Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.KeypadToneVolume = Level;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Keypad_Tone_Volume_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Keypad_Tone_Volume_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        }
    }
}

VOID Setting_Write_Warning_Tone_To_Nv(UINT8 nvData)
{
    UI_NV_Write_Req(NV_SECTION_UI_SETTINGS, (NV_SETTING_TONE_SETTING_OFFSET + 9), 1, &nvData);
}

/**
 * control warning tone
 * param (in) WarningToneStat: SETTING_WARNING_TONE_STAT
 * return void:
 */
VOID Setting_Set_Warning_Tone(SETTING_WARNING_TONE_STAT WarningToneStat)
{
    UINT8 nvData = 0;

    printf("%s: WarningToneStat = %d\n", __FUNCTION__, WarningToneStat);

    nvData = (UINT8)WarningToneStat;
    // update global variables
    g_OperatingTone->WarningToneStat = WarningToneStat;
    if(FALSE == g_SettingToneFunctionMng.ProfileTimingSta) {
        if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
            g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
            // write setting tone nv
            Setting_Write_Warning_Tone_To_Nv(nvData);
            // write setting profile nv
            Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileActivateIdx, nvData);
        } else {
            if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
                // write setting tone nv
                Setting_Write_Warning_Tone_To_Nv(nvData);
            } else {
            }
            // write setting profile nv
            Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
        }
    } else {
        if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileActivateIdx) {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
                // write setting tone nv
                Setting_Write_Warning_Tone_To_Nv(nvData);
                // write setting profile nv
                Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
                    // write setting tone nv
                    Setting_Write_Warning_Tone_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        } else {
            if(0xFF == g_SettingToneFunctionMng.ProfileEditingIdx) {
                g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
                // write setting profile nv
                Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileOperatingIdx, nvData);
            } else {
                if(g_SettingToneFunctionMng.ProfileOperatingIdx == g_SettingToneFunctionMng.ProfileEditingIdx) {
                    g_SettingToneSettingMng.WarningToneStat = WarningToneStat;
                } else if(g_SettingToneFunctionMng.ProfileActivateIdx == g_SettingToneFunctionMng.ProfileEditingIdx){
                    // write setting tone nv
                    Setting_Write_Warning_Tone_To_Nv(nvData);
                } else {
                }
                // write setting profile nv
                Setting_Profile_Write_Warning_Tone_To_Nv(g_SettingToneFunctionMng.ProfileEditingIdx, nvData);
            }
        }
    }
}

/**
 * update change profile parameter
 * param (in) ChgFlg: UINT8
 * param (in) ChgPara: UINT8
 * return void:
 */
VOID Setting_Update_Profile_Para(UINT8 ChgFlg, UINT8 ChgPara)
{
    switch(ChgFlg) {
        case 0: // update current editing profile index
            g_SettingToneFunctionMng.ProfileEditingIdx = ChgPara;
            break;
        case 1: // update current activate profile index
            g_SettingToneFunctionMng.ProfileActivateIdx = ChgPara;
            break;
        case 2: // update current timing status, TRUE: start profile timer, FALSE: stop profile timer
            if(0 == ChgPara) {
                g_SettingToneFunctionMng.ProfileTimingSta = FALSE;
            } else {
                g_SettingToneFunctionMng.ProfileTimingSta = TRUE;
            }
            break;
        case 3: // update current operating profile index
            g_SettingToneFunctionMng.ProfileOperatingIdx = ChgPara;
            break;
        default:
            break;
    }
}

/**
 * Translate vibrating state to Text Id for UI display
 * param (in) VibratingStat: SETTING_VIBRATING_STAT
 * return UINT16: TxtId
 */
UINT16 Setting_Vibrating_Stat_Translate_Into_Txtid(SETTING_VIBRATING_STAT VibratingStat)
{
    UINT16 TxtId = LV_LANG_TXT_ID_NONE;

    switch (VibratingStat)
    {
    case SETTING_VIBRATING_OFF:
        TxtId = PHONE_TEXT_ID_OFF;
        break;

    case SETTING_VIBRATING_ON:
        TxtId = PHONE_TEXT_ID_ON;
        break;

    case SETTING_VIBRATING_RING_THEN:
        TxtId = PHONE_TEXT_ID_VIBRA_THEN_RING;
        break;

    default:
        break;
    }

    return(TxtId);
}

/**
 * Translate message alert state to Text Id for UI display
 * param (in) MsgAlertStat: SETTING_MSG_ALERT_STAT
 * return UINT16: TxtId
 */
UINT16 Setting_Msg_Alert_Stat_Translate_Into_Txtid(SETTING_MSG_ALERT_STAT MsgAlertStat)
{
    UINT16 TxtId = LV_LANG_TXT_ID_NONE;

    switch (MsgAlertStat)
    {
    case SETTING_MSG_ALERT_OFF:
        TxtId = PHONE_TEXT_ID_OFF;
        break;

    case SETTING_MSG_ALERT_STANDARD:
        TxtId = PHONE_TEXT_ID_STANDARD;
        break;

    case SETTING_MSG_ALERT_RING:
        TxtId = PHONE_TEXT_ID_RINGING_TONE;
        break;

    default:
        break;
    }

    return(TxtId);
}

/**
 * Translate warning tone state to Text Id for UI display
 * param (in) WarningToneStat: SETTING_WARNING_TONE_STAT
 * return UINT16: TxtId
 */
UINT16 Setting_Warning_Tone_Stat_Translate_Into_Txtid(SETTING_WARNING_TONE_STAT WarningToneStat)
{
    UINT16 TxtId = LV_LANG_TXT_ID_NONE;

    if (SETTING_WARNING_TONE_OFF == WarningToneStat)
    {
        TxtId = PHONE_TEXT_ID_OFF;
    }
    else
    {
        TxtId = PHONE_TEXT_ID_ON;
    }

    return(TxtId);
}

/**
 * Callback Function of Setting_Done of Setting_Ringing_Tone(SIM1)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM1_Ring_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        INT8                       *Txt                = NULL;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        Setting_Set_Ring_Tone(MMI_MODEM_SIM_1, NormalListOnlyDesc->List.Index);
        Setting_Stop_Tone_Vibrating_Ui();

        Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Txt, g_RingToneList[NormalListOnlyDesc->List.Index].RingName, SETTING_MAX_NAME_LEN);

        Display_Setting_SIM_Selection_Set(LV_LANG_TXT_ID_NONE, LV_LANG_TXT_ID_NONE, Txt, NULL);
        Display_Setting_Done(ACT_ID_SETTING_RINGING_TONE, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Ringing_Tone(SIM2)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM2_Ring_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        INT8                       *Txt                = NULL;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        Setting_Set_Ring_Tone(MMI_MODEM_SIM_2, NormalListOnlyDesc->List.Index);
        Setting_Stop_Tone_Vibrating_Ui();

        Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Txt, g_RingToneList[NormalListOnlyDesc->List.Index].RingName, SETTING_MAX_NAME_LEN);

        Display_Setting_SIM_Selection_Set(LV_LANG_TXT_ID_NONE, LV_LANG_TXT_ID_NONE, NULL, Txt);
        Display_Setting_Done(ACT_ID_SETTING_RINGING_TONE, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Ringing_Tone of Setting_Message_Alert(SIM1)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM1_Message_Alert_Ring_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        INT8                       *Txt                = NULL;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        Setting_Set_Message_Tone(MMI_MODEM_SIM_1, NormalListOnlyDesc->List.Index);
        Setting_Stop_Tone_Vibrating_Ui();

        Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Txt, g_RingToneList[NormalListOnlyDesc->List.Index].RingName, SETTING_MAX_NAME_LEN);

        Display_Setting_SIM_Selection_Set(LV_LANG_TXT_ID_NONE, LV_LANG_TXT_ID_NONE, Txt, NULL);
        Display_Setting_Done(ACT_ID_SETTING_RINGING_TONE, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Ringing_Tone of Setting_Message_Alert(SIM2)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM2_Message_Alert_Ring_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        INT8                       *Txt                = NULL;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        Setting_Set_Message_Tone(MMI_MODEM_SIM_2, NormalListOnlyDesc->List.Index);
        Setting_Stop_Tone_Vibrating_Ui();

        Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Txt, g_RingToneList[NormalListOnlyDesc->List.Index].RingName, SETTING_MAX_NAME_LEN);

        Display_Setting_SIM_Selection_Set(LV_LANG_TXT_ID_NONE, LV_LANG_TXT_ID_NONE, NULL, Txt);
        Display_Setting_Done(ACT_ID_SETTING_RINGING_TONE, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Tone_Settings(Ringing Volume)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Ring_Vol_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;
        UINT8                           Value                    = 0;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;
        Value                   = lv_slider_get_value(NormalContainerListDesc->ContList.ContainerList[1].u.Bar.Bar);

        printf("Value of Ring vol is %d, RingVolume is %d in Display_Setting_Done_Ring_Vol_Cb\n",Value, g_OperatingTone->RingVolume);
        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Bar.Value = Value;
        Setting_Stop_Tone_Vibrating_Ui();
        Setting_Set_Ring_Volume(Value);
        Display_Setting_Done(ACT_ID_SETTING_TONE_SETTINGS, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Vibrating_Alert(ON)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Vibrating_Alert_ON_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;

        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Label2.TxtId = Setting_Vibrating_Stat_Translate_Into_Txtid(SETTING_VIBRATING_ON);
        Setting_Set_Vibrating(SETTING_VIBRATING_ON);
        Display_Setting_Done(ACT_ID_SETTING_VIBRATING_ALERT, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Vibrating_Alert(OFF)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Vibrating_Alert_OFF_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;

        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Label2.TxtId = Setting_Vibrating_Stat_Translate_Into_Txtid(SETTING_VIBRATING_OFF);

        Setting_Set_Vibrating(SETTING_VIBRATING_OFF);
        Display_Setting_Done(ACT_ID_SETTING_VIBRATING_ALERT, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Vibrating_Alert(RING_THEN)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Vibrating_Alert_VTR_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;

        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Label2.TxtId = Setting_Vibrating_Stat_Translate_Into_Txtid(SETTING_VIBRATING_RING_THEN);

        Setting_Set_Vibrating(SETTING_VIBRATING_RING_THEN);
        Display_Setting_Done(ACT_ID_SETTING_VIBRATING_ALERT, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Message_Alert(SIM1)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM1_Message_Alert_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        SETTING_MSG_ALERT_STAT     MsgAlertStat        = SETTING_MSG_ALERT_OFF;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        if (0 == NormalListOnlyDesc->List.Index)
        {
            MsgAlertStat = SETTING_MSG_ALERT_OFF;
        }
        else if (1 == NormalListOnlyDesc->List.Index)
        {
            MsgAlertStat = SETTING_MSG_ALERT_STANDARD;
            Setting_Set_Message_Tone(MMI_MODEM_SIM_1, UI_RING_TONE_MAX - 1);
        }

        Setting_Set_Alert_Stat(MMI_MODEM_SIM_1, MsgAlertStat);
        Display_Setting_SIM_Selection_Set(Setting_Msg_Alert_Stat_Translate_Into_Txtid(MsgAlertStat), LV_LANG_TXT_ID_NONE, NULL, NULL);
        Display_Setting_Done(ACT_ID_SETTING_MESSAGE_ALERT, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Tone_Settings(Keypad tones)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Keypad_Tones_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;
        UINT8                           Value                    = 0;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;
        Value                   = lv_slider_get_value(NormalContainerListDesc->ContList.ContainerList[4].u.Bar.Bar);

        printf("Value of Keypad vol is %d, KeypadToneVolume is %d in Display_Setting_Done_Keypad_Tones_Cb\n",Value, g_OperatingTone->KeypadToneVolume);
        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Bar.Value = Value;
        Setting_Set_Keypad_Tone_Volume(Value);
        Display_Setting_Done(ACT_ID_SETTING_TONE_SETTINGS, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Message_Alert(SIM2)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_SIM2_Message_Alert_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
        SETTING_MSG_ALERT_STAT     MsgAlertStat        = SETTING_MSG_ALERT_OFF;

        NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;

        if (0 == NormalListOnlyDesc->List.Index)
        {
            MsgAlertStat = SETTING_MSG_ALERT_OFF;
        }
        else if (1 == NormalListOnlyDesc->List.Index)
        {
            MsgAlertStat = SETTING_MSG_ALERT_STANDARD;
            Setting_Set_Message_Tone(MMI_MODEM_SIM_2, UI_RING_TONE_MAX - 1);
        }

        Setting_Set_Alert_Stat(MMI_MODEM_SIM_2, MsgAlertStat);
        Display_Setting_SIM_Selection_Set(LV_LANG_TXT_ID_NONE, Setting_Msg_Alert_Stat_Translate_Into_Txtid(MsgAlertStat), NULL, NULL);
        Display_Setting_Done(ACT_ID_SETTING_MESSAGE_ALERT, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_SIM_SELECTION);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Warning_Tones(ON)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Warning_Tones_ON_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;

        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Label2.TxtId = Setting_Warning_Tone_Stat_Translate_Into_Txtid(SETTING_WARNING_TONE_ON);
        Setting_Set_Warning_Tone(SETTING_WARNING_TONE_ON);
        Display_Setting_Done(ACT_ID_SETTING_WARNING_TONES, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Callback Function of Setting_Done of Setting_Warning_Tones(OFF)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Done_Warning_Tones_OFF_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

        NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;

        NormalContainerListDesc->ContList.ContainerList[NormalContainerListDesc->ContList.Index].u.Label2.TxtId = Setting_Warning_Tone_Stat_Translate_Into_Txtid(SETTING_WARNING_TONE_OFF);
        Setting_Set_Warning_Tone(SETTING_WARNING_TONE_OFF);
        Display_Setting_Done(ACT_ID_SETTING_WARNING_TONES, PHONE_TEXT_ID_DONE, ACT_ID_SETTING_TONE_SETTINGS);
    }
}

/**
 * Display Setting_Ringing_Tone, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Ringing_Tone_OnDestroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(NormalListOnlyDesc->List.ButtonList);
    Hal_Mem_Free(NormalListOnlyDesc);
}

/**
 * Display Setting_Ringing_Tone, OnSaveState Function, stop playing tone when interrupt by incoming call
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Ringing_Tone_OnSaveState(VOID *pPara)
{
    if(TRUE != Audio_Player_Is_Running())
    {
        Hal_NFFS_File_Play_End();
        if (SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat) {
            // vibrate setting
            Hal_Vibrator_Play_End();
        }
    }
}

/**
 * Key Callback Function of Setting_Ringing_Tone
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Ringing_Tone_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                      Ret                 = 0;
    UINT8                      Index               = 0;
    BOOL                       VibSupp             = FALSE;
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;
    Index              = NormalListOnlyDesc->List.Index;

    if(SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat) {
        VibSupp = TRUE;
    }

    if (KEY_DOWN == key_val)
    {
        Index++;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
        if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
            Setting_Stop_Tone_Vibrating_Ui();
            g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
            Setting_Play_Tone(Index, g_OperatingTone->RingVolume, VibSupp);
        }
    }
    else if (KEY_UP == key_val)
    {
        Index += NormalListOnlyDesc->List.ListButtonCnt;
        Index--;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
        if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
            Setting_Stop_Tone_Vibrating_Ui();
            g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
            Setting_Play_Tone(Index, g_OperatingTone->RingVolume, VibSupp);
        }
    }
    else if (KEY_SOFTRIGHT == key_val)
    {   // return to previous UI
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Back(ACT_ID_ANY);
        Ret = 1;
    }
    else if (KEY_END == key_val)
    {
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Home(ACT_ID_ANY);
        Ret = 1;
    }

    return(Ret);
} /* Display_Setting_Ringing_Tone_KeyCb */

/**
 * Display Setting_Ringing_Tone
 * param (in) SimId: MMI_MODEM_SIM_ID
 * return void:
 */
VOID Display_Setting_Ringing_Tone(MMI_MODEM_SIM_ID SimId)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
    UI_Button_Desc_t           *ButtonList         = NULL;
    UINT8                      i                   = 0;
    Nav_Func_List_t            FuncList;
    lv_event_cb_t              ReleaseFun;

    ButtonList         = (UI_Button_Desc_t *)Hal_Mem_Alloc(UI_RING_TONE_MAX * sizeof(UI_Button_Desc_t));
    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(ButtonList, 0, (UI_RING_TONE_MAX * sizeof(UI_Button_Desc_t)));
    Hal_Mem_Set(NormalListOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    NormalListOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_RINGING_TONE;
    NormalListOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalListOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (MMI_MODEM_SIM_1 == SimId)
    {
        ReleaseFun = Display_Setting_Done_SIM1_Ring_Cb;
    }
    else
    {
        ReleaseFun = Display_Setting_Done_SIM2_Ring_Cb;
    }

    for (i = 0; i < UI_RING_TONE_MAX; i++)
    {
        ButtonList[i].Valid       = TRUE;
        ButtonList[i].ButtonIndex = i;
        ButtonList[i].TxtId       = LV_LANG_TXT_ID_NONE;
        ButtonList[i].BtnTxt      = (INT8 *)Hal_Mem_Alloc(SETTING_MAX_NAME_LEN * sizeof(INT8));
        Hal_Mem_Copy(ButtonList[i].BtnTxt, g_RingToneList[i].RingName, SETTING_MAX_NAME_LEN);
        ButtonList[i].ReleaseFun = ReleaseFun;
    }

    NormalListOnlyDesc->List.ListButtonCnt = UI_RING_TONE_MAX;
    NormalListOnlyDesc->List.ButtonList    = ButtonList;
    NormalListOnlyDesc->List.Index         = g_OperatingTone->CurrentRingToneIndex[SimId];

    NormalListOnlyDesc->BtnBar.ButtonM.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    NormalListOnlyDesc->BtnBar.ButtonR.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalListOnlyDesc->KeyFunc = Display_Setting_Ringing_Tone_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow      = UI_Normal_List_Only_Create;
    FuncList.OnSaveState = Display_Setting_Ringing_Tone_OnSaveState;
    FuncList.OnDestroy   = Display_Setting_Ringing_Tone_OnDestroy;

    Nav_Forward(ACT_ID_SETTING_SIM_SELECTION, ACT_ID_SETTING_RINGING_TONE, &FuncList, (VOID *)NormalListOnlyDesc);
    gp_SettingToneCurListOnlyUIDesc = (VOID *)NormalListOnlyDesc;
} /* Display_Setting_Ringing_Tone */

/**
 * Callback Function of Setting_SIM_Selection of Setting_Ringing_Tone
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_SIM_Selection_Ringing_Tone_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UINT8 Sim1RingToneIndex = 0;
        UINT8 Sim2RingToneIndex = 0;
        INT8  *Sim1Txt          = NULL;
        INT8  *Sim2Txt          = NULL;

        Sim1RingToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_1];
        Sim2RingToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_2];

        Sim1Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Sim1Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Sim1Txt, g_RingToneList[Sim1RingToneIndex].RingName, SETTING_MAX_NAME_LEN);

        Sim2Txt = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
        Hal_Mem_Set(Sim2Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
        Hal_Mem_Copy(Sim2Txt, g_RingToneList[Sim2RingToneIndex].RingName, SETTING_MAX_NAME_LEN);

        Display_Setting_SIM_Selection(ACT_ID_SETTING_TONE_SETTINGS,LV_LANG_TXT_ID_NONE,LV_LANG_TXT_ID_NONE,Sim1Txt,Sim2Txt,Display_Setting_Ringing_Tone);
    }
}

/**
 * Display Setting_Ringing_Tone of Setting_Message_Alert, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Ringing_Tone_Message_Alert_OnDestroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(NormalListOnlyDesc->List.ButtonList);
    Hal_Mem_Free(NormalListOnlyDesc);
}

/**
 * Key Callback Function of Setting_Ringing_Tone of Setting_Message_Alert
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Ringing_Tone_Message_Alert_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                      Ret                 = 0;
    UINT8                      Index               = 0;
    BOOL                       VibSupp             = FALSE;
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;
    Index              = NormalListOnlyDesc->List.Index;

    if(SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat) {
        VibSupp = TRUE;
    }

    if (KEY_DOWN == key_val)
    {
        Index++;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
        if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
            Setting_Stop_Tone_Vibrating_Ui();
            g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
            Setting_Play_Tone(Index, g_OperatingTone->RingVolume, VibSupp);
        }
    }
    else if (KEY_UP == key_val)
    {
        Index += NormalListOnlyDesc->List.ListButtonCnt;
        Index--;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
        if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
            Setting_Stop_Tone_Vibrating_Ui();
            g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
            Setting_Play_Tone(Index, g_OperatingTone->RingVolume, VibSupp);
        }
    }
    else if (KEY_SOFTRIGHT == key_val)
    {   // return to previous UI
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Back(ACT_ID_ANY);
        Ret = 1;
    }
    else if (KEY_END == key_val)
    {
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Home(ACT_ID_ANY);
        Ret = 1;
    }

    return(Ret);
} /* Display_Setting_Ringing_Tone_Message_Alert_KeyCb */

/**
 * Display Setting_Ringing_Tone of Setting_Message_Alert
 * param (in) SimId: MMI_MODEM_SIM_ID
 * return void:
 */
VOID Display_Setting_Ringing_Tone_Message_Alert(MMI_MODEM_SIM_ID SimId)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
    UI_Button_Desc_t           *ButtonList         = NULL;
    UINT8                      i                   = 0;
    Nav_Func_List_t            FuncList;
    lv_event_cb_t              ReleaseFun;

    ButtonList         = (UI_Button_Desc_t *)Hal_Mem_Alloc(UI_RING_TONE_MAX * sizeof(UI_Button_Desc_t));
    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(ButtonList, 0, (UI_RING_TONE_MAX * sizeof(UI_Button_Desc_t)));
    Hal_Mem_Set(NormalListOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    NormalListOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_RINGING_TONE;
    NormalListOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalListOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (MMI_MODEM_SIM_1 == SimId)
    {
        ReleaseFun = Display_Setting_Done_SIM1_Message_Alert_Ring_Cb;
    }
    else
    {
        ReleaseFun = Display_Setting_Done_SIM2_Message_Alert_Ring_Cb;
    }

    for (i = 0; i < UI_RING_TONE_MAX; i++)
    {
        ButtonList[i].Valid       = TRUE;
        ButtonList[i].ButtonIndex = i;
        ButtonList[i].TxtId       = LV_LANG_TXT_ID_NONE;
        ButtonList[i].BtnTxt      = (INT8 *)Hal_Mem_Alloc(SETTING_MAX_NAME_LEN * sizeof(INT8));
        Hal_Mem_Copy(ButtonList[i].BtnTxt, g_RingToneList[i].RingName, SETTING_MAX_NAME_LEN);
        ButtonList[i].ReleaseFun = ReleaseFun;
    }

    NormalListOnlyDesc->List.ListButtonCnt = UI_RING_TONE_MAX;
    NormalListOnlyDesc->List.ButtonList    = ButtonList;
    NormalListOnlyDesc->List.Index         = g_OperatingTone->CurrentMsgToneIndex[SimId];

    NormalListOnlyDesc->BtnBar.ButtonM.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    NormalListOnlyDesc->BtnBar.ButtonR.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalListOnlyDesc->KeyFunc = Display_Setting_Ringing_Tone_Message_Alert_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow      = UI_Normal_List_Only_Create;
    FuncList.OnSaveState = Display_Setting_Ringing_Tone_OnSaveState;
    FuncList.OnDestroy   = Display_Setting_Ringing_Tone_Message_Alert_OnDestroy;

    Nav_Forward(ACT_ID_ANY, ACT_ID_SETTING_RINGING_TONE, &FuncList, (VOID *)NormalListOnlyDesc);
    gp_SettingToneCurListOnlyUIDesc = (VOID *)NormalListOnlyDesc;
} /* Display_Setting_Ringing_Tone_Message_Alert */

/**
 * Callback Function of Setting_Ringing_Tone of Setting_Message_Alert(SIM1)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Message_Alert_Ringing_Tone_SIM1_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Setting_Set_Alert_Stat(MMI_MODEM_SIM_1, SETTING_MSG_ALERT_RING);
        Display_Setting_Ringing_Tone_Message_Alert(MMI_MODEM_SIM_1);
    }
}

/**
 * Callback Function of Setting_Ringing_Tone of Setting_Message_Alert(SIM2)
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Message_Alert_Ringing_Tone_SIM2_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Setting_Set_Alert_Stat(MMI_MODEM_SIM_2, SETTING_MSG_ALERT_RING);
        Display_Setting_Ringing_Tone_Message_Alert(MMI_MODEM_SIM_2);
    }
}

/**
 * Display Setting_Message_Alert, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Message_Alert_OnDestroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(NormalListOnlyDesc->List.ButtonList);
    Hal_Mem_Free(NormalListOnlyDesc);
}

/**
 * Key Callback Function of Setting_Message_Alert
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Message_Alert_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                      Ret                 = 0;
    UINT8                      Index               = 0;
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;
    Index              = NormalListOnlyDesc->List.Index;

    if (KEY_DOWN == key_val)
    {
        Index++;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_UP == key_val)
    {
        Index += NormalListOnlyDesc->List.ListButtonCnt;
        Index--;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_SOFTRIGHT == key_val)
    {   // return to previous UI
        Nav_Back(ACT_ID_ANY);
        Ret = 1;
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        Ret = 1;
    }

    return(Ret);
}

/**
 * Display Setting_Message_Alert
 * param (in) SimId: MMI_MODEM_SIM_ID
 * return void:
 */
VOID Display_Setting_Message_Alert(MMI_MODEM_SIM_ID SimId)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
    UI_Button_Desc_t           *ButtonList         = NULL;
    Nav_Func_List_t            FuncList;
    lv_event_cb_t              ReleaseFunDone;
    lv_event_cb_t              ReleaseFunRingTone;

    ButtonList         = (UI_Button_Desc_t *)Hal_Mem_Alloc(3 * sizeof(UI_Button_Desc_t));
    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(ButtonList, 0, (3 * sizeof(UI_Button_Desc_t)));
    Hal_Mem_Set(NormalListOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    NormalListOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_SMS_TONE;
    NormalListOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalListOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    if (MMI_MODEM_SIM_1 == SimId)
    {
        ReleaseFunDone     = Display_Setting_Done_SIM1_Message_Alert_Cb;
        ReleaseFunRingTone = Display_Setting_Message_Alert_Ringing_Tone_SIM1_Cb;
    }
    else
    {
        ReleaseFunDone     = Display_Setting_Done_SIM2_Message_Alert_Cb;
        ReleaseFunRingTone = Display_Setting_Message_Alert_Ringing_Tone_SIM2_Cb;
    }

    ButtonList[0].Valid       = TRUE;
    ButtonList[0].ButtonIndex = 0;
    ButtonList[0].TxtId       = PHONE_TEXT_ID_OFF;
    ButtonList[0].ReleaseFun  = ReleaseFunDone;
    ButtonList[1].Valid       = TRUE;
    ButtonList[1].ButtonIndex = 1;
    ButtonList[1].TxtId       = PHONE_TEXT_ID_STANDARD;
    ButtonList[1].ReleaseFun  = ReleaseFunDone;
    ButtonList[2].Valid       = TRUE;
    ButtonList[2].ButtonIndex = 2;
    ButtonList[2].TxtId       = PHONE_TEXT_ID_RINGING_TONE;
    ButtonList[2].ReleaseFun  = ReleaseFunRingTone;

    NormalListOnlyDesc->List.ListButtonCnt = 3;
    NormalListOnlyDesc->List.ButtonList    = ButtonList;

    switch (g_OperatingTone->MsgAlertStat[SimId])
    {
    case SETTING_MSG_ALERT_OFF:
        NormalListOnlyDesc->List.Index = 0;
        break;

    case SETTING_MSG_ALERT_STANDARD:
        NormalListOnlyDesc->List.Index = 1;
        break;

    case SETTING_MSG_ALERT_RING:
        NormalListOnlyDesc->List.Index = 2;
        break;

    default:
        break;
    }

    NormalListOnlyDesc->BtnBar.ButtonM.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    NormalListOnlyDesc->BtnBar.ButtonR.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalListOnlyDesc->KeyFunc = Display_Setting_Message_Alert_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow    = UI_Normal_List_Only_Create;
    FuncList.OnDestroy = Display_Setting_Message_Alert_OnDestroy;

    Nav_Forward(ACT_ID_SETTING_SIM_SELECTION, ACT_ID_SETTING_MESSAGE_ALERT, &FuncList, (VOID *)NormalListOnlyDesc);
    gp_SettingToneCurListOnlyUIDesc = (VOID *)NormalListOnlyDesc;
} /* Display_Setting_Message_Alert */

/**
 * Callback Function of of Setting_SIM_Selection of Setting_Message_Alert
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_SIM_Selection_Message_Alert_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        UI_PHONE_TEXT_ID Sim1ValueTxtId    = LV_LANG_TXT_ID_NONE;
        UI_PHONE_TEXT_ID Sim2ValueTxtId    = LV_LANG_TXT_ID_NONE;
        UINT8            Sim1RingToneIndex = 0;
        UINT8            Sim2RingToneIndex = 0;
        INT8             *Sim1Txt          = NULL;
        INT8             *Sim2Txt          = NULL;

        if (SETTING_MSG_ALERT_RING == g_OperatingTone->MsgAlertStat[MMI_MODEM_SIM_1])
        {
            Sim1RingToneIndex = g_OperatingTone->CurrentMsgToneIndex[MMI_MODEM_SIM_1];
            Sim1Txt           = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
            Hal_Mem_Set(Sim1Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
            Hal_Mem_Copy(Sim1Txt, g_RingToneList[Sim1RingToneIndex].RingName, SETTING_MAX_NAME_LEN);
        }
        else
        {
            Sim1ValueTxtId = Setting_Msg_Alert_Stat_Translate_Into_Txtid(g_OperatingTone->MsgAlertStat[MMI_MODEM_SIM_1]);
        }

        if (SETTING_MSG_ALERT_RING == g_OperatingTone->MsgAlertStat[MMI_MODEM_SIM_2])
        {
            Sim2RingToneIndex = g_OperatingTone->CurrentMsgToneIndex[MMI_MODEM_SIM_2];
            Sim2Txt           = (INT8 *)Hal_Mem_Alloc(sizeof(INT8) * SETTING_MAX_NAME_LEN);
            Hal_Mem_Set(Sim2Txt, 0, (sizeof(INT8) * SETTING_MAX_NAME_LEN));
            Hal_Mem_Copy(Sim2Txt, g_RingToneList[Sim2RingToneIndex].RingName, SETTING_MAX_NAME_LEN);
        }
        else
        {
            Sim2ValueTxtId = Setting_Msg_Alert_Stat_Translate_Into_Txtid(g_OperatingTone->MsgAlertStat[MMI_MODEM_SIM_2]);
        }

        Display_Setting_SIM_Selection(ACT_ID_SETTING_TONE_SETTINGS,Sim1ValueTxtId,Sim2ValueTxtId,Sim1Txt,Sim2Txt,Display_Setting_Message_Alert);
    }
}

/**
 * Display Setting_Vibrating_Alert, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Vibrating_Alert_OnDestroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(NormalListOnlyDesc->List.ButtonList);
    Hal_Mem_Free(NormalListOnlyDesc);
}

/**
 * Key Callback Function of Setting_Vibrating_Alert
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Vibrating_Alert_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                      Ret                 = 0;
    UINT8                      Index               = 0;
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;
    Index              = NormalListOnlyDesc->List.Index;

    if (KEY_DOWN == key_val)
    {
        Index++;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_UP == key_val)
    {
        Index += NormalListOnlyDesc->List.ListButtonCnt;
        Index--;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_SOFTRIGHT == key_val)
    {   // return to previous UI
        Nav_Back(ACT_ID_ANY);
        Ret = 1;
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        Ret = 1;
    }

    return(Ret);
}

/**
 * Display Setting_Vibrating_Alert
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Vibrating_Alert(VOID)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
    UI_Button_Desc_t           *ButtonList         = NULL;
    Nav_Func_List_t            FuncList;

    ButtonList         = (UI_Button_Desc_t *)Hal_Mem_Alloc(3 * sizeof(UI_Button_Desc_t));
    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(ButtonList, 0, (3 * sizeof(UI_Button_Desc_t)));
    Hal_Mem_Set(NormalListOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    NormalListOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_VIBRATION_ALERT;
    NormalListOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalListOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    ButtonList[0].Valid       = TRUE;
    ButtonList[0].ButtonIndex = 0;
    ButtonList[0].TxtId       = PHONE_TEXT_ID_ON;
    ButtonList[0].ReleaseFun  = Display_Setting_Done_Vibrating_Alert_ON_Cb;
    ButtonList[1].Valid       = TRUE;
    ButtonList[1].ButtonIndex = 1;
    ButtonList[1].TxtId       = PHONE_TEXT_ID_OFF;
    ButtonList[1].ReleaseFun  = Display_Setting_Done_Vibrating_Alert_OFF_Cb;
    ButtonList[2].Valid       = TRUE;
    ButtonList[2].ButtonIndex = 2;
    ButtonList[2].TxtId       = PHONE_TEXT_ID_VIBRA_THEN_RING;
    ButtonList[2].ReleaseFun  = Display_Setting_Done_Vibrating_Alert_VTR_Cb;

    NormalListOnlyDesc->List.ListButtonCnt = 3;
    NormalListOnlyDesc->List.ButtonList    = ButtonList;

    switch (g_OperatingTone->VibratingStat)
    {
    case SETTING_VIBRATING_OFF:
        NormalListOnlyDesc->List.Index = 1;
        break;

    case SETTING_VIBRATING_ON:
        NormalListOnlyDesc->List.Index = 0;
        break;

    case SETTING_VIBRATING_RING_THEN:
        NormalListOnlyDesc->List.Index = 2;
        break;

    default:
        break;
    }

    NormalListOnlyDesc->BtnBar.ButtonM.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    NormalListOnlyDesc->BtnBar.ButtonR.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalListOnlyDesc->KeyFunc = Display_Setting_Vibrating_Alert_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow    = UI_Normal_List_Only_Create;
    FuncList.OnDestroy = Display_Setting_Vibrating_Alert_OnDestroy;

    Nav_Forward(ACT_ID_SETTING_TONE_SETTINGS, ACT_ID_SETTING_VIBRATING_ALERT, &FuncList, (VOID *)NormalListOnlyDesc);
    gp_SettingToneCurListOnlyUIDesc = (VOID *)NormalListOnlyDesc;
} /* Display_Setting_Vibrating_Alert */

/**
 * Callback Function of Setting_Vibrating_Alert
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Vibrating_Alert_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Vibrating_Alert();
    }
}

/**
 * Display Setting_Warning_Tones, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Warning_Tones_OnDestroy(VOID *pPara)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)pPara;

    Hal_Mem_Free(NormalListOnlyDesc->List.ButtonList);
    Hal_Mem_Free(NormalListOnlyDesc);
}

/**
 * Key Callback Function of Setting_Warning_Tones
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Warning_Tones_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                      Ret                 = 0;
    UINT8                      Index               = 0;
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }

    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)gp_SettingToneCurListOnlyUIDesc;
    Index              = NormalListOnlyDesc->List.Index;

    if (KEY_DOWN == key_val)
    {
        Index++;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_UP == key_val)
    {
        Index += NormalListOnlyDesc->List.ListButtonCnt;
        Index--;
        Index                         %= NormalListOnlyDesc->List.ListButtonCnt;
        NormalListOnlyDesc->List.Index = Index;
    }
    else if (KEY_SOFTRIGHT == key_val)
    {   // return to previous UI
        Nav_Back(ACT_ID_ANY);
        Ret = 1;
    }
    else if (KEY_END == key_val)
    {
        Nav_Home(ACT_ID_ANY);
        Ret = 1;
    }

    return(Ret);
}

/**
 * Display Setting_Warning_Tones
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Warning_Tones(VOID)
{
    UI_Normal_List_Only_Desc_t *NormalListOnlyDesc = NULL;
    UI_Button_Desc_t           *ButtonList         = NULL;
    Nav_Func_List_t            FuncList;

    ButtonList         = (UI_Button_Desc_t *)Hal_Mem_Alloc(2 * sizeof(UI_Button_Desc_t));
    NormalListOnlyDesc = (UI_Normal_List_Only_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_List_Only_Desc_t));
    Hal_Mem_Set(ButtonList, 0, (2 * sizeof(UI_Button_Desc_t)));
    Hal_Mem_Set(NormalListOnlyDesc, 0, sizeof(UI_Normal_List_Only_Desc_t));

    NormalListOnlyDesc->TitleBar.TxtId      = PHONE_TEXT_ID_WARNING_TONE;
    NormalListOnlyDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalListOnlyDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    ButtonList[0].Valid       = TRUE;
    ButtonList[0].ButtonIndex = 0;
    ButtonList[0].TxtId       = PHONE_TEXT_ID_ON;
    ButtonList[0].ReleaseFun  = Display_Setting_Done_Warning_Tones_ON_Cb;
    ButtonList[1].Valid       = TRUE;
    ButtonList[1].ButtonIndex = 1;
    ButtonList[1].TxtId       = PHONE_TEXT_ID_OFF;
    ButtonList[1].ReleaseFun  = Display_Setting_Done_Warning_Tones_OFF_Cb;

    NormalListOnlyDesc->List.ListButtonCnt = 2;
    NormalListOnlyDesc->List.ButtonList    = ButtonList;

    if (SETTING_WARNING_TONE_OFF == g_OperatingTone->WarningToneStat)
    {
        NormalListOnlyDesc->List.Index = 1;
    }
    else if (SETTING_WARNING_TONE_ON == g_OperatingTone->WarningToneStat)
    {
        NormalListOnlyDesc->List.Index = 0;
    }

    NormalListOnlyDesc->BtnBar.ButtonM.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonM.TxtId = PHONE_TEXT_ID_OK;
    NormalListOnlyDesc->BtnBar.ButtonR.Valid = TRUE;
    NormalListOnlyDesc->BtnBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalListOnlyDesc->KeyFunc = Display_Setting_Warning_Tones_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow    = UI_Normal_List_Only_Create;
    FuncList.OnDestroy = Display_Setting_Warning_Tones_OnDestroy;

    Nav_Forward(ACT_ID_SETTING_TONE_SETTINGS, ACT_ID_SETTING_WARNING_TONES, &FuncList, (VOID *)NormalListOnlyDesc);
    gp_SettingToneCurListOnlyUIDesc = (VOID *)NormalListOnlyDesc;
} /* Display_Setting_Warning_Tones */

/**
 * Callback Function of Setting_Warning_Tones
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return void:
 */
VOID Display_Setting_Warning_Tones_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if (LV_EVENT_CLICKED == Event)
    {
        Display_Setting_Warning_Tones();
    }
}

/**
 * Display Setting_Tone_Settings, OnDestroy Function, free pointer
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Tone_Settings_OnDestroy(VOID *pPara)
{
    UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

    NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)pPara;

    Hal_Mem_Free(NormalContainerListDesc->ContList.ContainerList);
    Hal_Mem_Free(NormalContainerListDesc);
    if(NULL != g_OperatingTone) {
        Setting_Profile_Setting_Update(g_OperatingTone);
        printf("%s: g_OperatingTone free proc, address = %p\n", __FUNCTION__, g_OperatingTone);
        Hal_Mem_Free(g_OperatingTone);
        g_OperatingTone = NULL;
    }
}

/**
 * Key Callback Function of Setting_Tone_Settings
 * param (in) obj: lv_obj_t*
 *       (in) key_sta: UI_KEY_STATUS
 *       (in) key_val: UI_KEY_VALUE
 * return UINT8: 0--call system handling outside
 *               1--handled inside
 */
UINT8 Display_Setting_Tone_Settings_KeyCb(lv_obj_t *obj, UI_KEY_STATUS key_sta, UI_KEY_VALUE key_val)
{
    UINT8                           Ret                      = 0;
    UINT8                           Index                    = 0;
    UINT8                           Value                    = 0;
    UINT8                           ToneIndex                = 0;
    BOOL                            VibSupp                  = FALSE;
    UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;

    if (KEY_RELEASED != key_sta)
    {
        return(Ret);
    }
    NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)gp_SettingToneCurContainerListUIDesc;
    Index                   = NormalContainerListDesc->ContList.Index;

    switch (key_val)
    {
    case KEY_DOWN:
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Index++;
        Index                                  %= NormalContainerListDesc->ContList.ListContainerCnt;
        NormalContainerListDesc->ContList.Index = Index;
        printf("Index(press down) is %d in Display_Setting_Tone_Settings_KeyCb\n",Index);
        break;

    case KEY_UP:
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Index += NormalContainerListDesc->ContList.ListContainerCnt;
        Index--;
        Index                                  %= NormalContainerListDesc->ContList.ListContainerCnt;
        NormalContainerListDesc->ContList.Index = Index;
        printf("Index(press up) is %d in Display_Setting_Tone_Settings_KeyCb\n",Index);
        break;

    case KEY_LEFT:
        if ((1 == Index) || (4 == Index))
        {   // Ring volume or Keypad tones volume,update valur of bar
            Value = lv_slider_get_value(NormalContainerListDesc->ContList.ContainerList[Index].u.Bar.Bar);

            if (1 == Index)
            {     // Ring volume
                if (TRUE == g_SettingSimStatus[MMI_MODEM_SIM_1])
                { // SIM1 present, play SIM1 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_1];
                }
                else if (TRUE == g_SettingSimStatus[MMI_MODEM_SIM_2])
                {   // SIM1 absent, play SIM2 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_2];
                }
                else
                {   // both sim absent, play SIM1 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_1];
                }

                printf("%s: key left, VibratingStat = %d\n", __FUNCTION__, g_OperatingTone->VibratingStat);
                if (SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat)
                {
                    VibSupp = TRUE;
                }

                printf("Value of Ring vol(press left) is %d, RingVolume is %d in Display_Setting_Tone_Settings_KeyCb\n",Value, g_OperatingTone->RingVolume);
            }
            else if (4 == Index)
            {   // Keypad tones volume
                // ToneIndex = <index of keypad>;
                printf("Value of Keypad vol(press left) is %d, KeypadToneVolume is %d in Display_Setting_Tone_Settings_KeyCb\n",Value, g_OperatingTone->KeypadToneVolume);
            }
            printf("%s: key left, Index = %d, VibSupp = %d, TonePrio = %d\n", __FUNCTION__, Index, VibSupp,g_SettingToneFunctionMng.TonePrio);
            if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
                Setting_Stop_Tone_Vibrating_Ui();
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
                Setting_Play_Tone(ToneIndex, Value, VibSupp);
            }
        }
        Ret = 1;
        break;

    case KEY_RIGHT:
        if ((1 == Index) || (4 == Index))
        {
            Value = lv_slider_get_value(NormalContainerListDesc->ContList.ContainerList[Index].u.Bar.Bar);

            if (1 == Index)
            {
                if (TRUE == g_SettingSimStatus[MMI_MODEM_SIM_1])
                {   // SIM1 present, play SIM1 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_1];
                }
                else if (TRUE == g_SettingSimStatus[MMI_MODEM_SIM_2])
                {   // SIM1 absent, play SIM2 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_2];
                }
                else
                {   // both sim absent, play SIM1 tone
                    ToneIndex = g_OperatingTone->CurrentRingToneIndex[MMI_MODEM_SIM_1];
                }

                printf("%s: key right, VibratingStat = %d\n", __FUNCTION__, g_OperatingTone->VibratingStat);
                if (SETTING_VIBRATING_OFF != g_OperatingTone->VibratingStat)
                {
                    VibSupp = TRUE;
                }

                printf("Value of Ring vol(press left) is %d, RingVolume is %d in Display_Setting_Tone_Settings_KeyCb\n",Value, g_OperatingTone->RingVolume);
            }
            else if (4 == Index)
            {
                // ToneIndex = <index of keypad>;
                printf("Value of Keypad vol(press left) is %d, KeypadToneVolume is %d in Display_Setting_Tone_Settings_KeyCb\n",Value, g_OperatingTone->KeypadToneVolume);
            }
            printf("%s: key right, Index = %d, VibSupp = %d, TonePrio = %d\n", __FUNCTION__, Index, VibSupp,g_SettingToneFunctionMng.TonePrio);
            if((SETTING_TONE_PRIO_SETTING >= g_SettingToneFunctionMng.TonePrio) && (TRUE != Audio_Player_Is_Running())) {
                Setting_Stop_Tone_Vibrating_Ui();
                g_SettingToneFunctionMng.TonePrio = SETTING_TONE_PRIO_SETTING;
                Setting_Play_Tone(ToneIndex, Value, VibSupp);
            }
        }
        Ret = 1;
        break;

    case KEY_SOFTRIGHT:
        // return to previous UI
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Back(ACT_ID_ANY);
        Ret = 1;
        break;

    case KEY_END:
        if(SETTING_TONE_PRIO_SETTING == g_SettingToneFunctionMng.TonePrio) {
            Setting_Stop_Tone_Vibrating_Ui();
        }

        Nav_Home(ACT_ID_ANY);
        Ret = 1;
        break;

    default:
        break;
    } /* switch */

    return(Ret);
} /* Display_Setting_Tone_Settings_KeyCb */

/**
 * Display Setting_Tone_Settings
 * param (in) void:
 * return void:
 */
VOID Display_Setting_Tone_Settings(VOID)
{
    UI_Normal_Container_List_Desc_t *NormalContainerListDesc = NULL;
    UI_Container_Base_Desc_t        *ContainerList           = NULL;
    Nav_Func_List_t                 FuncList;

    printf("RingVolume is %d in Display_Setting_Tone_Settings\n",g_OperatingTone->RingVolume);
    printf("KeypadToneVolume is %d in Display_Setting_Tone_Settings\n", g_OperatingTone->KeypadToneVolume);

    ContainerList           = (UI_Container_Base_Desc_t *)Hal_Mem_Alloc(6 * sizeof(UI_Container_Base_Desc_t));
    NormalContainerListDesc = (UI_Normal_Container_List_Desc_t *)Hal_Mem_Alloc(sizeof(UI_Normal_Container_List_Desc_t));
    Hal_Mem_Set(ContainerList, 0, (6 * sizeof(UI_Container_Base_Desc_t)));
    Hal_Mem_Set(NormalContainerListDesc, 0, sizeof(UI_Normal_Container_List_Desc_t));

    NormalContainerListDesc->TitleBar.TxtId      = PHONE_TEXT_ID_TONE_SETTINGS;
    NormalContainerListDesc->TitleBar.TxtAlign   = LV_LABEL_ALIGN_CENTER;
    NormalContainerListDesc->TitleBar.LabelAlign = LV_ALIGN_IN_TOP_LEFT;

    ContainerList[0].Label.TxtId      = PHONE_TEXT_ID_RINGING_TONE;
    ContainerList[0].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    ContainerList[0].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[0].Choise           = UI_BASE_OBJ_NULL;
    ContainerList[0].ReleaseFunc      = Display_Setting_SIM_Selection_Ringing_Tone_Cb;
    ContainerList[0].Valid            = TRUE;

    ContainerList[1].Label.TxtId      = PHONE_TEXT_ID_RINGING_VOL;
    ContainerList[1].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    ContainerList[1].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[1].Choise           = UI_BASE_OBJ_BAR;
    ContainerList[1].u.Bar.Range      = SETTING_MAX_VOLUME_LEVEL;
    ContainerList[1].u.Bar.Value      = g_OperatingTone->RingVolume;
    ContainerList[1].u.Bar.BarAlign   = LV_ALIGN_IN_BOTTOM_LEFT;
    ContainerList[1].ReleaseFunc      = Display_Setting_Done_Ring_Vol_Cb;
    ContainerList[1].Valid            = TRUE;

    ContainerList[2].Label.TxtId         = PHONE_TEXT_ID_VIBRATION_ALERT;
    ContainerList[2].Label.TxtAlign      = LV_LABEL_ALIGN_LEFT;
    ContainerList[2].Label.LabelAlign    = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[2].Choise              = UI_BASE_OBJ_LABEL;
    ContainerList[2].u.Label2.TxtId      = Setting_Vibrating_Stat_Translate_Into_Txtid(g_OperatingTone->VibratingStat);
    ContainerList[2].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    ContainerList[2].u.Label2.LabelAlign = LV_ALIGN_IN_BOTTOM_LEFT;
    ContainerList[2].ReleaseFunc         = Display_Setting_Vibrating_Alert_Cb;
    ContainerList[2].Valid               = TRUE;

    ContainerList[3].Label.TxtId      = PHONE_TEXT_ID_SMS_TONE;
    ContainerList[3].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    ContainerList[3].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[3].Choise           = UI_BASE_OBJ_NULL;
    ContainerList[3].ReleaseFunc      = Display_Setting_SIM_Selection_Message_Alert_Cb;
    ContainerList[3].Valid            = TRUE;

    ContainerList[4].Label.TxtId      = PHONE_TEXT_ID_KEYPAD_TONE;
    ContainerList[4].Label.TxtAlign   = LV_LABEL_ALIGN_LEFT;
    ContainerList[4].Label.LabelAlign = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[4].Choise           = UI_BASE_OBJ_BAR;
    ContainerList[4].u.Bar.Range      = SETTING_MAX_VOLUME_LEVEL;
    ContainerList[4].u.Bar.Value      = g_OperatingTone->KeypadToneVolume;
    ContainerList[4].u.Bar.BarAlign   = LV_ALIGN_IN_BOTTOM_LEFT;
    ContainerList[4].ReleaseFunc      = Display_Setting_Done_Keypad_Tones_Cb;
    ContainerList[4].Valid            = TRUE;

    ContainerList[5].Label.TxtId         = PHONE_TEXT_ID_WARNING_TONE;
    ContainerList[5].Label.TxtAlign      = LV_LABEL_ALIGN_LEFT;
    ContainerList[5].Label.LabelAlign    = LV_ALIGN_IN_TOP_LEFT;
    ContainerList[5].Choise              = UI_BASE_OBJ_LABEL;
    ContainerList[5].u.Label2.TxtId      = Setting_Warning_Tone_Stat_Translate_Into_Txtid(g_OperatingTone->WarningToneStat);
    ContainerList[5].u.Label2.TxtAlign   = LV_LABEL_ALIGN_RIGHT;
    ContainerList[5].u.Label2.LabelAlign = LV_ALIGN_IN_BOTTOM_LEFT;
    ContainerList[5].ReleaseFunc         = Display_Setting_Warning_Tones_Cb;
    ContainerList[5].Valid               = TRUE;

    NormalContainerListDesc->ContList.ListContainerCnt = 6;
    NormalContainerListDesc->ContList.ContainerList    = ContainerList;

    NormalContainerListDesc->ButtonBar.ButtonM.Valid = TRUE;
    NormalContainerListDesc->ButtonBar.ButtonM.TxtId = PHONE_TEXT_ID_SELECT;
    NormalContainerListDesc->ButtonBar.ButtonR.Valid = TRUE;
    NormalContainerListDesc->ButtonBar.ButtonR.TxtId = PHONE_TEXT_ID_BACK;

    NormalContainerListDesc->KeyFunc = Display_Setting_Tone_Settings_KeyCb;

    Hal_Mem_Set(&FuncList, 0, sizeof(Nav_Func_List_t));
    FuncList.OnShow    = UI_Normal_Container_List_Create;
    FuncList.OnDestroy = Display_Setting_Tone_Settings_OnDestroy;

    Nav_Forward(ACT_ID_ANY, ACT_ID_SETTING_TONE_SETTINGS, &FuncList, (VOID *)NormalContainerListDesc);
    gp_SettingToneCurContainerListUIDesc = (VOID *)NormalContainerListDesc;
} /* Display_Setting_Tone_Settings */

/**
 * Callback Function of Setting_Tone_Settings
 * param (in) Btn: lv_obj_t*
 * param (in) Event: lv_event_t
 * return lv_res_t: LV_RES_OK
 */
VOID Display_Setting_Tone_Settings_Cb(lv_obj_t *Btn, lv_event_t Event)
{
    if(LV_EVENT_CLICKED == Event)
    {
        g_SettingToneFunctionMng.ProfileEditingIdx = 0xFF;
        Setting_Set_Operating_Tone(&g_SettingToneSettingMng);
        Display_Setting_Tone_Settings();
    }
}
